﻿public class LdElemRefAstTree : LuaAstTree
{
    public LuaAstTree Array;
    public LuaAstTree Index;
    public LdElemRefAstTree(LuaAstTree array, LuaAstTree index)
    {
        Array = array;
        Index = index;
    }
    public override void WriteTo(ICodeWriter writer)
    {
        Array.WriteTo(writer);
        writer.Code("[");
        Index.WriteTo(writer);
        writer.Code("]");
    }
}

public class StElemRefAstTree : LuaAstTree
{
    public LuaAstTree Array { get; }
    public LuaAstTree Index { get; }
    public LuaAstTree Value { get; }
    public StElemRefAstTree(LuaAstTree array, LuaAstTree index, LuaAstTree value)
    {
        Array = array;
        Index = index;
        Value = value;
    }
    public override void WriteTo(ICodeWriter writer)
    {
        Array.WriteTo(writer);
        writer.Code("[");
        Index.WriteTo(writer);
        writer.Code("+1");
        writer.Code("] = ");
        Value.WriteTo(writer);
    }
}